﻿using System;
using System.Collections.Generic;
using ZyGames.DZPocker.Model;
using ZyGames.Framework.Cache.Generic;
using ZyGames.Framework.Game.Cache;
using ZyGames.Framework.Game.Context;
using ZyGames.Framework.Game.Contract;
using ZyGames.Framework.Game.Contract.Action;
using ZyGames.Framework.Game.Lang;
using ZyGames.Framework.Game.Service;
using System.Linq;
using ZyGames.DZPocker.Bll.Logic;
using ZyGames.DZPocker.Script;

namespace ZyGames.DZPocker.Script.CsScript.Action
{
	/// <summary>
	/// 同步所有玩家和底池的筹码
	/// </summary>
	public class Action30009 : BaseAction
	{
		private int _tableId;
		/// <summary>
		/// 桌子底池的筹码
		/// </summary>
		private int _tableAnt;

		/// <summary>
		/// 所有参与的玩家的筹码  List<UserBeat>   UserBeat:  UserId  PosId  Chip
		/// </summary>
		private string _usersChip;
		public Action30009(HttpGet actionGetter)
			: base((short)ActionType.DZSyncAllChipNum, actionGetter)
		{
		}
		public override bool GetUrlElement()
		{
			if (httpGet.GetInt("TableID", ref _tableId) &&
				httpGet.GetInt("TableAnt", ref _tableAnt) &&
				httpGet.GetString("UsersChip", ref _usersChip))
			{
				return true;
			}
			return false;
		}

		public override bool TakeAction()
		{
			return true;
		}

		public override void BuildPacket()
		{
			this.PushIntoStack(_tableId);
			this.PushIntoStack(_tableAnt);
			this.PushIntoStack(_usersChip);
		}
	}
}
